package com.dimples.dd.system.convert;

import com.dimples.dd.common.model.Option;
import com.dimples.dd.common.pojo.PageResult;
import com.dimples.dd.system.model.entity.SystemPostDO;
import com.dimples.dd.system.model.form.PostForm;
import com.dimples.dd.system.model.vo.PostPageVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @author zhongyj <1126834403@qq.com><br/>
 * @date 2024/8/1
 */
@Mapper(componentModel = "spring")
public interface PostConverter {
     PageResult<PostPageVO> entity2Vo(PageResult<SystemPostDO> systemPostDOPageResult);

     @Mappings({
             @Mapping(source = "id", target = "value"),
             @Mapping(source = "name", target = "label")
     })
     Option<Long> entity2Option(SystemPostDO role);


     List<Option<Long>> entities2Options(List<SystemPostDO> list);

     PostForm entity2Form(SystemPostDO systemPostDO);

     SystemPostDO form2Entity(PostForm postForm);
}
